<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>sgp4oo: Fichero Fuente sgp4io.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="files.html"><span>Archivos</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;archivos</span></a></li>
      <li><a href="globals.html"><span>Miembros&nbsp;de&nbsp;los&nbsp;ficheros</span></a></li>
    </ul>
  </div>
<h1>sgp4io.cpp</h1><a href="sgp4io_8cpp.html">Ir a la documentación de este archivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*     ----------------------------------------------------------------</span>
<a name="l00002"></a>00002 <span class="comment">*  @brief this file contains a function to read two line element sets. while</span>
<a name="l00003"></a>00003 <span class="comment">*    not formerly part of the sgp4 mathematical theory, it is</span>
<a name="l00004"></a>00004 <span class="comment">*    required for practical implemenation.</span>
<a name="l00005"></a>00005 <span class="comment">*   @author david vallado</span>
<a name="l00006"></a>00006 <span class="comment">*                               sgp4io.cpp</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">*    this file contains a function to read two line element sets. while </span>
<a name="l00009"></a>00009 <span class="comment">*    not formerly part of the sgp4 mathematical theory, it is </span>
<a name="l00010"></a>00010 <span class="comment">*    required for practical implemenation.</span>
<a name="l00011"></a>00011 <span class="comment">*</span>
<a name="l00012"></a>00012 <span class="comment">*                            companion code for</span>
<a name="l00013"></a>00013 <span class="comment">*               fundamentals of astrodynamics and applications</span>
<a name="l00014"></a>00014 <span class="comment">*                                    2007</span>
<a name="l00015"></a>00015 <span class="comment">*                              by david vallado</span>
<a name="l00016"></a>00016 <span class="comment">*</span>
<a name="l00017"></a>00017 <span class="comment">*       (w) 719-573-2600, email dvallado@agi.com</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">*    current :</span>
<a name="l00020"></a>00020 <span class="comment">*               3 sep 08  david vallado</span>
<a name="l00021"></a>00021 <span class="comment">*                           add operationmode for afspc (a) or improved (i)</span>
<a name="l00022"></a>00022 <span class="comment">*    changes :</span>
<a name="l00023"></a>00023 <span class="comment">*               9 may 07  david vallado</span>
<a name="l00024"></a>00024 <span class="comment">*                           fix year correction to 57</span>
<a name="l00025"></a>00025 <span class="comment">*              27 mar 07  david vallado</span>
<a name="l00026"></a>00026 <span class="comment">*                           misc fixes to manual inputs</span>
<a name="l00027"></a>00027 <span class="comment">*              14 aug 06  david vallado</span>
<a name="l00028"></a>00028 <span class="comment">*                           original baseline</span>
<a name="l00029"></a>00029 <span class="comment">*       ----------------------------------------------------------------      */</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="sgp4io_8h.html">sgp4io.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__math_8h.html">sgp4_math.h</a>&quot;</span>    <span class="comment">// for several misc routines</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__date_8h.html">sgp4_date.h</a>&quot;</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="comment">/* -----------------------------------------------------------------------------</span>
<a name="l00036"></a>00036 <span class="comment">**    @brief  this function converts the two line element set character string data to</span>
<a name="l00037"></a>00037 <span class="comment">*    variables and initializes the sgp4 variables</span>
<a name="l00038"></a>00038 <span class="comment">*     @param  longstr1    - first line of the tle</span>
<a name="l00039"></a>00039 <span class="comment">*     @param  longstr2    - second line of the tle</span>
<a name="l00040"></a>00040 <span class="comment">*     @param  typerun     - type of run</span>
<a name="l00041"></a>00041 <span class="comment">*     @param  typeinput   - type of manual input           mfe &#39;m&#39;, epoch &#39;e&#39;, dayofyr &#39;d&#39;</span>
<a name="l00042"></a>00042 <span class="comment">*     @param  opsmode     - mode of operation afspc or improved &#39;a&#39;, &#39;i&#39;</span>
<a name="l00043"></a>00043 <span class="comment">*     @param  whichconst  - which set of constants to use  72, 84</span>
<a name="l00044"></a>00044 <span class="comment">*     @param  satrec      outputs- structure containing all the sgp4 satellite information*</span>
<a name="l00045"></a>00045 <span class="comment">*     @author  david vallado</span>
<a name="l00046"></a>00046 <span class="comment">*</span>
<a name="l00047"></a>00047 <span class="comment">*                           function twoline2rv</span>
<a name="l00048"></a>00048 <span class="comment">*</span>
<a name="l00049"></a>00049 <span class="comment">*  this function converts the two line element set character string data to</span>
<a name="l00050"></a>00050 <span class="comment">*    variables and initializes the sgp4 variables. several intermediate varaibles</span>
<a name="l00051"></a>00051 <span class="comment">*    and quantities are determined. note that the result is a structure so multiple</span>
<a name="l00052"></a>00052 <span class="comment">*    satellites can be processed simultaneously without having to reinitialize. the</span>
<a name="l00053"></a>00053 <span class="comment">*    verification mode is an important option that permits quick checks of any</span>
<a name="l00054"></a>00054 <span class="comment">*    changes to the underlying technical theory. this option works using a</span>
<a name="l00055"></a>00055 <span class="comment">*    modified tle file in which the start, stop, and delta time values are</span>
<a name="l00056"></a>00056 <span class="comment">*    included at the end of the second line of data. this only works with the</span>
<a name="l00057"></a>00057 <span class="comment">*    verification mode. the catalog mode simply propagates from -1440 to 1440 min</span>
<a name="l00058"></a>00058 <span class="comment">*    from epoch and is useful when performing entire catalog runs.</span>
<a name="l00059"></a>00059 <span class="comment">*</span>
<a name="l00060"></a>00060 <span class="comment">*  author        : david vallado                  719-573-2600    1 mar 2001</span>
<a name="l00061"></a>00061 <span class="comment">*</span>
<a name="l00062"></a>00062 <span class="comment">*  inputs        :</span>
<a name="l00063"></a>00063 <span class="comment">*    longstr1    - first line of the tle</span>
<a name="l00064"></a>00064 <span class="comment">*    longstr2    - second line of the tle</span>
<a name="l00065"></a>00065 <span class="comment">*    typerun     - type of run                    verification &#39;v&#39;, catalog &#39;c&#39;, </span>
<a name="l00066"></a>00066 <span class="comment">*                                                 manual &#39;m&#39;</span>
<a name="l00067"></a>00067 <span class="comment">*    typeinput   - type of manual input           mfe &#39;m&#39;, epoch &#39;e&#39;, dayofyr &#39;d&#39;</span>
<a name="l00068"></a>00068 <span class="comment">*    opsmode     - mode of operation afspc or improved &#39;a&#39;, &#39;i&#39;</span>
<a name="l00069"></a>00069 <span class="comment">*    whichconst  - which set of constants to use  72, 84</span>
<a name="l00070"></a>00070 <span class="comment">*</span>
<a name="l00071"></a>00071 <span class="comment">*  outputs       :</span>
<a name="l00072"></a>00072 <span class="comment">*    satrec      - structure containing all the sgp4 satellite information</span>
<a name="l00073"></a>00073 <span class="comment">*</span>
<a name="l00074"></a>00074 <span class="comment">*  coupling      :</span>
<a name="l00075"></a>00075 <span class="comment">*    getgravconst-</span>
<a name="l00076"></a>00076 <span class="comment">*    days2mdhms  - conversion of days to month, day, hour, minute, second</span>
<a name="l00077"></a>00077 <span class="comment">*    jday        - convert day month year hour minute second into julian date</span>
<a name="l00078"></a>00078 <span class="comment">*    sgp4init    - initialize the sgp4 variables</span>
<a name="l00079"></a>00079 <span class="comment">*</span>
<a name="l00080"></a>00080 <span class="comment">*  references    :</span>
<a name="l00081"></a>00081 <span class="comment">*    norad spacetrack report #3</span>
<a name="l00082"></a>00082 <span class="comment">*    vallado, crawford, hujsak, kelso  2006</span>
<a name="l00083"></a>00083 <span class="comment">*</span>
<a name="l00084"></a>00084 <span class="comment">*</span>
<a name="l00085"></a>00085 <span class="comment">  --------------------------------------------------------------------------- */</span>
<a name="l00097"></a><a class="code" href="class_sgp4io.html#ac9194a51d266f17bbdf76a443f660439">00097</a> <a class="code" href="class_sgp4unit.html">Sgp4unit</a>*  <a class="code" href="class_sgp4io.html#ac9194a51d266f17bbdf76a443f660439" title="Esta función convierte el conjunto de datos de carácteres String two line element...">Sgp4io::twoline2rv</a>(
<a name="l00098"></a>00098       <span class="keywordtype">char</span>      longstr1[130], <span class="keywordtype">char</span> longstr2[130],
<a name="l00099"></a>00099       <span class="keywordtype">char</span>      typerun,  <span class="keywordtype">char</span> typeinput, <span class="keywordtype">char</span> opsmode,
<a name="l00100"></a>00100       <a class="code" href="gravconsttype_8h.html#a8b910c09824c4a9d8365e717c31dda5e">gravconsttype</a>       whichconst,
<a name="l00101"></a>00101       <span class="keywordtype">double</span>&amp; startmfe, <span class="keywordtype">double</span>&amp; stopmfe, <span class="keywordtype">double</span>&amp; deltamin)
<a name="l00102"></a>00102      {
<a name="l00103"></a>00103        <span class="keyword">const</span> <span class="keywordtype">double</span> deg2rad  =   <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> / 180.0;         <span class="comment">//   0.0174532925199433</span>
<a name="l00104"></a>00104        <span class="keyword">const</span> <span class="keywordtype">double</span> xpdotp   =  1440.0 / (2.0 *<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>);  <span class="comment">// 229.1831180523293</span>
<a name="l00105"></a>00105 
<a name="l00106"></a>00106        <span class="keywordtype">double</span> sec, mu, radiusearthkm, tumin, xke, j2, j3, j4, j3oj2;
<a name="l00107"></a>00107        <span class="keywordtype">double</span> startsec, stopsec, startdayofyr, stopdayofyr, jdstart, jdstop;
<a name="l00108"></a>00108        <span class="keywordtype">int</span> startyear, stopyear, startmon, stopmon, startday, stopday,
<a name="l00109"></a>00109            starthr, stophr, startmin, stopmin;
<a name="l00110"></a>00110        <span class="keywordtype">int</span> cardnumb, numb, j;
<a name="l00111"></a>00111        <span class="keywordtype">long</span> revnum = 0, elnum = 0;
<a name="l00112"></a>00112        <span class="keywordtype">char</span> classification, intldesg[11];
<a name="l00113"></a>00113        <span class="keywordtype">int</span> year = 0;
<a name="l00114"></a>00114        <span class="keywordtype">int</span> mon, day, hr, minute, nexp, ibexp;
<a name="l00115"></a>00115 
<a name="l00116"></a>00116        <a class="code" href="class_sgp4unit.html">Sgp4unit</a>* sgp4 =<span class="keyword">new</span> <a class="code" href="class_sgp4unit.html">Sgp4unit</a>();
<a name="l00117"></a>00117        <a class="code" href="classelsetrec.html">elsetrec</a>* satrec=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>();
<a name="l00118"></a>00118        <span class="keywordtype">long</span> <span class="keywordtype">int</span> satsum=satsum;
<a name="l00119"></a>00119        <span class="keywordtype">int</span> epochyr=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#ac29471547fc77f9ace4be2be46809d00">getEpochyr</a>();
<a name="l00120"></a>00120 
<a name="l00121"></a>00121        <span class="keywordtype">double</span> epochdays=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a663f61b7268992a9d419570febd2488a">getEpochdays</a>();
<a name="l00122"></a>00122        <span class="keywordtype">double</span> ndot=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a22f9b536398deea8dc6b51ca3a05e109">getNdot</a>();
<a name="l00123"></a>00123        <span class="keywordtype">double</span> nddot=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a0fe459fe273d53876432b66c34826a04">getNddot</a>();
<a name="l00124"></a>00124        <span class="keywordtype">double</span> bstar=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a281a2c521a026f570655ac03452c1376">getBstar</a>();
<a name="l00125"></a>00125 
<a name="l00126"></a>00126        <span class="keywordtype">double</span> inclo=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>();
<a name="l00127"></a>00127            <span class="keywordtype">double</span> nodeo=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>();
<a name="l00128"></a>00128            <span class="keywordtype">double</span> ecco=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>();
<a name="l00129"></a>00129            <span class="keywordtype">double</span> argpo=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a8277731f022d9bae8a04db99c41f8250">getArgpo</a>();
<a name="l00130"></a>00130            <span class="keywordtype">double</span> mo=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a68b23c77320e1f54f23b92ec62693ae9">getMo</a>();
<a name="l00131"></a>00131            <span class="keywordtype">double</span> no=sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>();
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 
<a name="l00134"></a>00134        <a class="code" href="gravconsttype_8cpp.html#ad4600d22fe78cc71f195a7c50ed92f3b" title="Esta función se utiliza para obtener el conjunto de valores dependiendo de la constante...">getgravconst</a>( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
<a name="l00135"></a>00135 
<a name="l00136"></a>00136        sgp4-&gt;<a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">getSatrec</a>()-&gt;<a class="code" href="classelsetrec.html#a739213a57aacaa9e972d1bd9f09f175b">setError</a>(0);
<a name="l00137"></a>00137 
<a name="l00138"></a>00138        <span class="comment">// set the implied decimal points since doing a formated read</span>
<a name="l00139"></a>00139        <span class="comment">// fixes for bad input data values (missing, ...)</span>
<a name="l00140"></a>00140        <span class="keywordflow">for</span> (j = 10; j &lt;= 15; j++)
<a name="l00141"></a>00141            <span class="keywordflow">if</span> (longstr1[j] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00142"></a>00142                longstr1[j] = <span class="charliteral">&#39;_&#39;</span>;
<a name="l00143"></a>00143 
<a name="l00144"></a>00144        <span class="keywordflow">if</span> (longstr1[44] != <span class="charliteral">&#39; &#39;</span>)
<a name="l00145"></a>00145            longstr1[43] = longstr1[44];
<a name="l00146"></a>00146        longstr1[44] = <span class="charliteral">&#39;.&#39;</span>;
<a name="l00147"></a>00147        <span class="keywordflow">if</span> (longstr1[7] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00148"></a>00148            longstr1[7] = <span class="charliteral">&#39;U&#39;</span>;
<a name="l00149"></a>00149        <span class="keywordflow">if</span> (longstr1[9] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00150"></a>00150            longstr1[9] = <span class="charliteral">&#39;.&#39;</span>;
<a name="l00151"></a>00151        <span class="keywordflow">for</span> (j = 45; j &lt;= 49; j++)
<a name="l00152"></a>00152            <span class="keywordflow">if</span> (longstr1[j] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00153"></a>00153                longstr1[j] = <span class="charliteral">&#39;0&#39;</span>;
<a name="l00154"></a>00154        <span class="keywordflow">if</span> (longstr1[51] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00155"></a>00155            longstr1[51] = <span class="charliteral">&#39;0&#39;</span>;
<a name="l00156"></a>00156        <span class="keywordflow">if</span> (longstr1[53] != <span class="charliteral">&#39; &#39;</span>)
<a name="l00157"></a>00157            longstr1[52] = longstr1[53];
<a name="l00158"></a>00158        longstr1[53] = <span class="charliteral">&#39;.&#39;</span>;
<a name="l00159"></a>00159        longstr2[25] = <span class="charliteral">&#39;.&#39;</span>;
<a name="l00160"></a>00160        <span class="keywordflow">for</span> (j = 26; j &lt;= 32; j++)
<a name="l00161"></a>00161            <span class="keywordflow">if</span> (longstr2[j] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00162"></a>00162                longstr2[j] = <span class="charliteral">&#39;0&#39;</span>;
<a name="l00163"></a>00163        <span class="keywordflow">if</span> (longstr1[62] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00164"></a>00164            longstr1[62] = <span class="charliteral">&#39;0&#39;</span>;
<a name="l00165"></a>00165        <span class="keywordflow">if</span> (longstr1[68] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00166"></a>00166            longstr1[68] = <span class="charliteral">&#39;0&#39;</span>;
<a name="l00167"></a>00167 
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 
<a name="l00171"></a>00171 
<a name="l00172"></a>00172        sscanf(longstr1,<span class="stringliteral">&quot;%2d %5ld %1c %10s %2d %12lf %11lf %7lf %2d %7lf %2d %2d %6ld &quot;</span>,
<a name="l00173"></a>00173                    &amp;cardnumb,&amp;satsum,&amp;classification, intldesg,&amp;epochyr,
<a name="l00174"></a>00174                &amp;epochdays,&amp;ndot,&amp;nddot, &amp;nexp,&amp;bstar,
<a name="l00175"></a>00175                &amp;ibexp, &amp;numb, &amp;elnum );
<a name="l00176"></a>00176 
<a name="l00177"></a>00177        <span class="keywordflow">if</span> (typerun == <span class="charliteral">&#39;v&#39;</span>)  <span class="comment">// run for specified times from the file</span>
<a name="l00178"></a>00178          {
<a name="l00179"></a>00179            <span class="keywordflow">if</span> (longstr2[52] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00180"></a>00180                sscanf(longstr2,<span class="stringliteral">&quot;%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld %lf %lf %lf \n&quot;</span>,
<a name="l00181"></a>00181                        &amp;cardnumb,&amp;satsum,&amp;inclo,
<a name="l00182"></a>00182                        &amp;nodeo,&amp;ecco, &amp;argpo, &amp;mo,&amp;no,
<a name="l00183"></a>00183                        &amp;revnum, &amp;startmfe, &amp;stopmfe, &amp;deltamin );
<a name="l00184"></a>00184              <span class="keywordflow">else</span>
<a name="l00185"></a>00185                sscanf(longstr2,<span class="stringliteral">&quot;%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld %lf %lf %lf \n&quot;</span>,
<a name="l00186"></a>00186                        &amp;cardnumb,&amp;satsum,&amp;inclo,
<a name="l00187"></a>00187                        &amp;nodeo,&amp;ecco, &amp;argpo,&amp;mo, &amp;no,
<a name="l00188"></a>00188                        &amp;revnum, &amp;startmfe, &amp;stopmfe, &amp;deltamin );
<a name="l00189"></a>00189          }
<a name="l00190"></a>00190          <span class="keywordflow">else</span>  <span class="comment">// simply run -1 day to +1 day or user input times</span>
<a name="l00191"></a>00191          {
<a name="l00192"></a>00192            <span class="keywordflow">if</span> (longstr2[52] == <span class="charliteral">&#39; &#39;</span>)
<a name="l00193"></a>00193                sscanf(longstr2,<span class="stringliteral">&quot;%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld \n&quot;</span>,
<a name="l00194"></a>00194                        &amp;cardnumb,&amp;satsum,&amp;inclo,
<a name="l00195"></a>00195                        &amp;nodeo,&amp;ecco, &amp;argpo,&amp;mo,&amp;no,
<a name="l00196"></a>00196                        &amp;revnum );
<a name="l00197"></a>00197              <span class="keywordflow">else</span>
<a name="l00198"></a>00198                sscanf(longstr2,<span class="stringliteral">&quot;%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld \n&quot;</span>,
<a name="l00199"></a>00199                        &amp;cardnumb,&amp;satsum, &amp;inclo,
<a name="l00200"></a>00200                        &amp;nodeo,&amp;ecco, &amp;argpo, &amp;mo, &amp;no,
<a name="l00201"></a>00201                        &amp;revnum );
<a name="l00202"></a>00202          }
<a name="l00203"></a>00203        satrec-&gt;<a class="code" href="classelsetrec.html#a7d8badd89d22ac1b9d2bd53ffd4cb90d">setSatnum</a>(satsum);
<a name="l00204"></a>00204        satrec-&gt;<a class="code" href="classelsetrec.html#a1902fa0f34b46206e6622d9560704acb">setEpochdays</a>(epochdays);
<a name="l00205"></a>00205        satrec-&gt;<a class="code" href="classelsetrec.html#acf8aff6f6be7315027fb3bd15411f425">setEpochyr</a>(epochyr);
<a name="l00206"></a>00206        satrec-&gt;<a class="code" href="classelsetrec.html#aba1ed46e79ec1390738b269d05f885a0">setNdot</a>(ndot);
<a name="l00207"></a>00207        satrec-&gt;<a class="code" href="classelsetrec.html#aad334dfe3babb3ece8c85e4cddf1e23b">setNddot</a>(nddot);
<a name="l00208"></a>00208        satrec-&gt;<a class="code" href="classelsetrec.html#ac724bac683c3a3e09b166503495738c0">setBstar</a>(bstar);
<a name="l00209"></a>00209        satrec-&gt;<a class="code" href="classelsetrec.html#aaa38289b489e1717d2df1f69b7eaadc7">setInclo</a>(inclo);
<a name="l00210"></a>00210        satrec-&gt;<a class="code" href="classelsetrec.html#ae85d091ffe938a8b19a0b0beff94d6fe">setNodeo</a>(nodeo);
<a name="l00211"></a>00211        satrec-&gt;<a class="code" href="classelsetrec.html#aa687e2144ca729bf729dde29f3064e52">setEcco</a>(ecco);
<a name="l00212"></a>00212        satrec-&gt;<a class="code" href="classelsetrec.html#afddcb123544f40ef1023804c52ac923b">setArgpo</a>(argpo);
<a name="l00213"></a>00213        satrec-&gt;<a class="code" href="classelsetrec.html#a3ca431f2abe7cbf3608f1f5b0b313b2e">setMo</a>(mo);
<a name="l00214"></a>00214        satrec-&gt;<a class="code" href="classelsetrec.html#aaed8e64890844a64c8f2d260bee471c2">setNo</a>(no);
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 
<a name="l00217"></a>00217 
<a name="l00218"></a>00218 
<a name="l00219"></a>00219        <span class="comment">// ---- find no, ndot, nddot ----</span>
<a name="l00220"></a>00220        satrec-&gt;<a class="code" href="classelsetrec.html#aaed8e64890844a64c8f2d260bee471c2">setNo</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>() / xpdotp); <span class="comment">//* rad/min</span>
<a name="l00221"></a>00221        satrec-&gt;<a class="code" href="classelsetrec.html#aad334dfe3babb3ece8c85e4cddf1e23b">setNddot</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a0fe459fe273d53876432b66c34826a04">getNddot</a>() * pow(10.0, nexp));
<a name="l00222"></a>00222        satrec-&gt;<a class="code" href="classelsetrec.html#ac724bac683c3a3e09b166503495738c0">setBstar</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a281a2c521a026f570655ac03452c1376">getBstar</a>() * pow(10.0, ibexp));
<a name="l00223"></a>00223 
<a name="l00224"></a>00224        <span class="comment">// ---- convert to sgp4 units ----</span>
<a name="l00225"></a>00225        satrec-&gt;<a class="code" href="classelsetrec.html#a8a7ccce2156e0a26a5547ecf89dca595">setA</a>    ( pow( satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>()*tumin , (-2.0/3.0) ));
<a name="l00226"></a>00226        satrec-&gt;<a class="code" href="classelsetrec.html#aba1ed46e79ec1390738b269d05f885a0">setNdot</a> ( satrec-&gt;<a class="code" href="classelsetrec.html#a22f9b536398deea8dc6b51ca3a05e109">getNdot</a>()  / (xpdotp*1440.0));  <span class="comment">//* ? * minperday</span>
<a name="l00227"></a>00227        satrec-&gt;<a class="code" href="classelsetrec.html#aad334dfe3babb3ece8c85e4cddf1e23b">setNddot</a>( satrec-&gt;<a class="code" href="classelsetrec.html#a0fe459fe273d53876432b66c34826a04">getNddot</a>() / (xpdotp*1440.0*1440));
<a name="l00228"></a>00228 
<a name="l00229"></a>00229        <span class="comment">// ---- find standard orbital elements ----</span>
<a name="l00230"></a>00230        satrec-&gt;<a class="code" href="classelsetrec.html#aaa38289b489e1717d2df1f69b7eaadc7">setInclo</a>( satrec-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>()  * deg2rad);
<a name="l00231"></a>00231        satrec-&gt;<a class="code" href="classelsetrec.html#ae85d091ffe938a8b19a0b0beff94d6fe">setNodeo</a>( satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>()  * deg2rad);
<a name="l00232"></a>00232        satrec-&gt;<a class="code" href="classelsetrec.html#afddcb123544f40ef1023804c52ac923b">setArgpo</a>( satrec-&gt;<a class="code" href="classelsetrec.html#a8277731f022d9bae8a04db99c41f8250">getArgpo</a>()  * deg2rad);
<a name="l00233"></a>00233        satrec-&gt;<a class="code" href="classelsetrec.html#a3ca431f2abe7cbf3608f1f5b0b313b2e">setMo</a>    (satrec-&gt;<a class="code" href="classelsetrec.html#a68b23c77320e1f54f23b92ec62693ae9">getMo</a>()     * deg2rad);
<a name="l00234"></a>00234 
<a name="l00235"></a>00235        satrec-&gt;<a class="code" href="classelsetrec.html#a44bf53252b657c9f5213dfe2ea31ad44">setAlta</a> ( satrec-&gt;<a class="code" href="classelsetrec.html#a3cc96db83b275c4ec3850f00335a11f5">getA</a>()*(1.0 + satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>()) - 1.0);
<a name="l00236"></a>00236        satrec-&gt;<a class="code" href="classelsetrec.html#a4dc275b66219501005fea9d416a7be5d">setAltp</a> ( satrec-&gt;<a class="code" href="classelsetrec.html#a3cc96db83b275c4ec3850f00335a11f5">getA</a>()*(1.0 - satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>()) - 1.0);
<a name="l00237"></a>00237 
<a name="l00238"></a>00238        <span class="comment">// ----------------------------------------------------------------</span>
<a name="l00239"></a>00239        <span class="comment">// find sgp4epoch time of element set</span>
<a name="l00240"></a>00240        <span class="comment">// remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)</span>
<a name="l00241"></a>00241        <span class="comment">// and minutes from the epoch (time)</span>
<a name="l00242"></a>00242        <span class="comment">// ----------------------------------------------------------------</span>
<a name="l00243"></a>00243 
<a name="l00244"></a>00244        <span class="comment">// ---------------- temp fix for years from 1957-2056 -------------------</span>
<a name="l00245"></a>00245        <span class="comment">// --------- correct fix will occur when year is 4-digit in tle ---------</span>
<a name="l00246"></a>00246        <span class="keywordflow">if</span> (satrec-&gt;<a class="code" href="classelsetrec.html#ac29471547fc77f9ace4be2be46809d00">getEpochyr</a>() &lt; 57)
<a name="l00247"></a>00247            year= satrec-&gt;<a class="code" href="classelsetrec.html#ac29471547fc77f9ace4be2be46809d00">getEpochyr</a>() + 2000;
<a name="l00248"></a>00248          <span class="keywordflow">else</span>
<a name="l00249"></a>00249            year= satrec-&gt;<a class="code" href="classelsetrec.html#ac29471547fc77f9ace4be2be46809d00">getEpochyr</a>() + 1900;
<a name="l00250"></a>00250             <a class="code" href="classsgp4__date.html#a270e3d9269bc498a33fef618016e6d79" title="this procedure converts the day of the year, days, to the equivalent month day, hour...">sgp4_date::days2mdhms</a> ( year,satrec-&gt;<a class="code" href="classelsetrec.html#a663f61b7268992a9d419570febd2488a">getEpochdays</a>(), mon,day,hr,minute,sec );
<a name="l00251"></a>00251            <span class="keywordtype">double</span> jd2=0;
<a name="l00252"></a>00252            <a class="code" href="classsgp4__date.html#a3c1affde9b5a9badeec11f39f0fe1552" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_date::jday</a>( year,mon,day,hr,minute,sec,jd2);
<a name="l00253"></a>00253 
<a name="l00254"></a>00254            satrec-&gt;<a class="code" href="classelsetrec.html#a8bd809e3a5d607b637d4db3c6ceaf806">setJdsatepoch</a>(jd2);
<a name="l00255"></a>00255 
<a name="l00256"></a>00256        <span class="comment">// ---- input start stop times manually</span>
<a name="l00257"></a>00257        <span class="keywordflow">if</span> ((typerun != <span class="charliteral">&#39;v&#39;</span>) &amp;&amp; (typerun != <span class="charliteral">&#39;c&#39;</span>))
<a name="l00258"></a>00258          {
<a name="l00259"></a>00259          <span class="comment">// ------------- enter start/stop ymd hms values --------------------</span>
<a name="l00260"></a>00260            <span class="keywordflow">if</span> (typeinput == <span class="charliteral">&#39;e&#39;</span>)
<a name="l00261"></a>00261              {
<a name="l00262"></a>00262                printf(<span class="stringliteral">&quot;input start prop year mon day hr min sec \n&quot;</span>);
<a name="l00263"></a>00263                <span class="comment">// make sure there is no space at the end of the format specifiers in scanf!</span>
<a name="l00264"></a>00264                scanf( <span class="stringliteral">&quot;%i %i %i %i %i %lf&quot;</span>,&amp;startyear, &amp;startmon, &amp;startday, &amp;starthr, &amp;startmin, &amp;startsec);
<a name="l00265"></a>00265                fflush(stdin);
<a name="l00266"></a>00266                <a class="code" href="classsgp4__date.html#a3c1affde9b5a9badeec11f39f0fe1552" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_date::jday</a>( startyear,startmon,startday,starthr,startmin,startsec, jdstart );
<a name="l00267"></a>00267 
<a name="l00268"></a>00268                printf(<span class="stringliteral">&quot;input stop prop year mon day hr min sec \n&quot;</span>);
<a name="l00269"></a>00269                scanf( <span class="stringliteral">&quot;%i %i %i %i %i %lf&quot;</span>,&amp;stopyear, &amp;stopmon, &amp;stopday, &amp;stophr, &amp;stopmin, &amp;stopsec);
<a name="l00270"></a>00270                fflush(stdin);
<a name="l00271"></a>00271                <a class="code" href="classsgp4__date.html#a3c1affde9b5a9badeec11f39f0fe1552" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_date::jday</a>( stopyear,stopmon,stopday,stophr,stopmin,stopsec, jdstop );
<a name="l00272"></a>00272 
<a name="l00273"></a>00273                startmfe = (jdstart - satrec-&gt;<a class="code" href="classelsetrec.html#ab47cd45cef4d10d5579f222359b18047">getJdsatepoch</a>()) * 1440.0;
<a name="l00274"></a>00274                stopmfe  = (jdstop - satrec-&gt;<a class="code" href="classelsetrec.html#ab47cd45cef4d10d5579f222359b18047">getJdsatepoch</a>()) * 1440.0;
<a name="l00275"></a>00275 
<a name="l00276"></a>00276                printf(<span class="stringliteral">&quot;input time step in minutes \n&quot;</span>);
<a name="l00277"></a>00277                scanf( <span class="stringliteral">&quot;%lf&quot;</span>,&amp;deltamin );
<a name="l00278"></a>00278              }
<a name="l00279"></a>00279            <span class="comment">// -------- enter start/stop year and days of year values -----------</span>
<a name="l00280"></a>00280            <span class="keywordflow">if</span> (typeinput == <span class="charliteral">&#39;d&#39;</span>)
<a name="l00281"></a>00281              {
<a name="l00282"></a>00282                printf(<span class="stringliteral">&quot;input start year dayofyr \n&quot;</span>);
<a name="l00283"></a>00283                scanf( <span class="stringliteral">&quot;%i %lf&quot;</span>,&amp;startyear, &amp;startdayofyr );
<a name="l00284"></a>00284                printf(<span class="stringliteral">&quot;input stop year dayofyr \n&quot;</span>);
<a name="l00285"></a>00285                scanf( <span class="stringliteral">&quot;%i %lf&quot;</span>,&amp;stopyear, &amp;stopdayofyr );
<a name="l00286"></a>00286 
<a name="l00287"></a>00287                 <a class="code" href="classsgp4__date.html#a270e3d9269bc498a33fef618016e6d79" title="this procedure converts the day of the year, days, to the equivalent month day, hour...">sgp4_date::days2mdhms</a> ( startyear,startdayofyr, mon,day,hr,minute,sec );
<a name="l00288"></a>00288                <a class="code" href="classsgp4__date.html#a3c1affde9b5a9badeec11f39f0fe1552" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_date::jday</a>( startyear,mon,day,hr,minute,sec, jdstart );
<a name="l00289"></a>00289                 <a class="code" href="classsgp4__date.html#a270e3d9269bc498a33fef618016e6d79" title="this procedure converts the day of the year, days, to the equivalent month day, hour...">sgp4_date::days2mdhms</a> ( stopyear,stopdayofyr, mon,day,hr,minute,sec );
<a name="l00290"></a>00290                 <a class="code" href="classsgp4__date.html#a3c1affde9b5a9badeec11f39f0fe1552" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_date::jday</a>( stopyear,mon,day,hr,minute,sec, jdstop );
<a name="l00291"></a>00291 
<a name="l00292"></a>00292                startmfe = (jdstart - satrec-&gt;<a class="code" href="classelsetrec.html#ab47cd45cef4d10d5579f222359b18047">getJdsatepoch</a>()) * 1440.0;
<a name="l00293"></a>00293                stopmfe  = (jdstop - satrec-&gt;<a class="code" href="classelsetrec.html#ab47cd45cef4d10d5579f222359b18047">getJdsatepoch</a>()) * 1440.0;
<a name="l00294"></a>00294 
<a name="l00295"></a>00295                printf(<span class="stringliteral">&quot;input time step in minutes \n&quot;</span>);
<a name="l00296"></a>00296                scanf( <span class="stringliteral">&quot;%lf&quot;</span>,&amp;deltamin );
<a name="l00297"></a>00297              }
<a name="l00298"></a>00298            <span class="comment">// ------------------ enter start/stop mfe values -------------------</span>
<a name="l00299"></a>00299            <span class="keywordflow">if</span> (typeinput == <span class="charliteral">&#39;m&#39;</span>)
<a name="l00300"></a>00300              {
<a name="l00301"></a>00301                printf(<span class="stringliteral">&quot;input start min from epoch \n&quot;</span>);
<a name="l00302"></a>00302                scanf( <span class="stringliteral">&quot;%lf&quot;</span>,&amp;startmfe );
<a name="l00303"></a>00303                printf(<span class="stringliteral">&quot;input stop min from epoch \n&quot;</span>);
<a name="l00304"></a>00304                scanf( <span class="stringliteral">&quot;%lf&quot;</span>,&amp;stopmfe );
<a name="l00305"></a>00305                printf(<span class="stringliteral">&quot;input time step in minutes \n&quot;</span>);
<a name="l00306"></a>00306                scanf( <span class="stringliteral">&quot;%lf&quot;</span>,&amp;deltamin );
<a name="l00307"></a>00307              }
<a name="l00308"></a>00308          }
<a name="l00309"></a>00309 
<a name="l00310"></a>00310        <span class="comment">// ------------ perform complete catalog evaluation, -+ 1 day ----------- </span>
<a name="l00311"></a>00311        <span class="keywordflow">if</span> (typerun == <span class="charliteral">&#39;c&#39;</span>)
<a name="l00312"></a>00312          {
<a name="l00313"></a>00313            startmfe = -1440.0;
<a name="l00314"></a>00314            stopmfe  =  1440.0;
<a name="l00315"></a>00315            deltamin =    10.0;
<a name="l00316"></a>00316          }
<a name="l00317"></a>00317 
<a name="l00318"></a>00318        <span class="comment">// ---------------- initialize the orbit at sgp4epoch -------------------</span>
<a name="l00319"></a>00319       sgp4-&gt;<a class="code" href="class_sgp4unit.html#ad084f0a30db5884099f45453ff92c05a" title="Inicializa las variables del sistema sgp4.">sgp4init</a>( whichconst, opsmode);
<a name="l00320"></a>00320       <span class="keywordflow">return</span> sgp4;
<a name="l00321"></a>00321     } <span class="comment">// end twoline2rv</span>
<a name="l00322"></a>00322 
<a name="l00323"></a>00323 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generado el Tue May 22 09:43:43 2012 para sgp4oo por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
